<!--
*Author：COCO
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/custom/custom/Base_DefectItem.js此处编写
 -->
<template>
    <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields"
        :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions"
        :table="table" :extend="extend">
    </view-grid>
</template>
<script>
import extend from "@/extension/Ware/Ware_Product.js";
import { ref, defineComponent } from "vue";
export default defineComponent({
    setup() {
        const table = ref({
            key: 'ProductId',
            footer: "Foots",
            cnName: '成品管理',
            name: 'Ware/Ware_Product',
            url: "/Ware_Product/",
            sortName: "CreateDate"
        });
        const editFormFields = ref({ "ProductCode": "", "ProductName": "", "ProductType": "", "ProductBatch": "","WareId":"", "RawmanagementId":"","ProductCompany": "", "ProductNumS": "", "ProductNumX": "", "ProductSave": "", "ProductState": "", "ProductNote": "", "ProductImg": "" });
        const editFormOptions = ref([[{ "title": "成品编号", "field": "ProductCode", "type": "text" }],
        [{ "title": "成品名称", "required": true, "field": "ProductName", "type": "text" }]
            , [{ "title": "规格型号", "required": true, "field": "ProductType", "type": "text" }]
            , [{ "title": "批次号", "required": true, "field": "ProductBatch", "type": "text" }]
            , [{ "dataKey": "Ware_ProductCompany", "data": [], "title": "单位", "field": "ProductCompany", "type": "select" }]
            , [{ "dataKey": "RawmanagementType", "data": [], "title": "原料", "field": "RawmanagementId", "type": "select" }]
            , [{ "title": "库存上限", "required": true, "field": "ProductNumS", "type": "text" }]
            , [{ "title": "库存下限", "required": true, "field": "ProductNumX", "type": "text" }]
            , [{ "title": "报警天数", "required": true, "field": "ProductSave", "type": "number" }]
            , [{ "dataKey": "Ware_ProductState", "data": [], "title": "状态", "field": "ProductState", "type": "radio" }]
            , [{ "title": "备注", "field": "ProductNote", "type": "textarea" }]
            , [{ "title": "图片", "field": "ProductImg", "type": "img" }]]);
        const searchFormFields = ref({ "ProductCode": "", "ProductName": "", "ProductType": "", "ProductBatch": "","RawmanagementId":"", "ProductCompany": "", "ProductNumS": "", "ProductNumX": "", "ProductSave": [null, null], "ProductState": "", "ProductNote": "", "ProductImg": "" });
        const searchFormOptions = ref([[{ "title": "成品编号", "field": "ProductCode", "type": "like" }]
            , [{ "title": "成品名称", "field": "ProductName", "type": "like" }]
            , [{ "title": "规格型号", "field": "ProductType", "type": "like" }]
            , [{ "title": "批次号", "field": "ProductBatch", "type": "like" }]
            , [{ "dataKey": "Ware_ProductCompany", "data": [], "title": "单位", "field": "ProductCompany", "type": "select" }]
            , [{ "dataKey": "RawmanagementType", "data": [], "title": "原料", "field": "RawmanagementId", "type": "select" }]
            , [{ "title": "库存上限", "field": "ProductNumS", "type": "like" }]
            , [{ "title": "库存下限", "field": "ProductNumX", "type": "like" }]
            , [{ "title": "报警天数", "field": "ProductSave", "type": "range" }]
            , [{ "dataKey": "Ware_ProductState", "data": [], "title": "状态", "field": "ProductState", "type": "radio" }]
            , [{ "title": "备注", "field": "ProductNote", "type": "like" }]
            , [{ "title": "图片", "field": "ProductImg", "type": "like" }]]);
        const columns = ref([{ field: 'ProductId', title: '成品管理主键', type: 'int', width: 110, hidden: true, readonly: true, require: true, align: 'left' },
        { field: 'ProductCode', title: '成品编号', type: 'string', sort: true, width: 180, align: 'left', sort: true },
        { field: 'ProductName', title: '成品名称', type: 'string', link: true, sort: true, width: 180, require: true, align: 'left' },
        { field: 'ProductType', title: '规格型号', type: 'string', link: true, sort: true, width: 180, require: true, align: 'left' },
        { field: 'ProductBatch', title: '批次号', type: 'string', link: true, sort: true, width: 180, require: true, align: 'left' },
        { field: 'ProductCompany', title: '单位', type: 'int', bind: { key: 'Ware_ProductCompany', data: [] }, width: 120, align: 'left' },
         { field: 'RawmanagementId', title: '原料', type: 'guid', bind: { key: 'RawmanagementType', data: [] }, width: 120, align: 'left' },
        { field: 'ProductNumS', title: '库存上限', type: 'int', link: true, sort: true, width: 180, require: true, align: 'left' },
        { field: 'ProductNumX', title: '库存下限', type: 'int', link: true, sort: true, width: 180, require: true, align: 'left' },
        { field: 'ProductSave', title: '报警天数', type: 'int', width: 110, require: true, align: 'left' },
        { field: 'ProductState', title: '状态', type: 'int', bind: { key: 'Ware_ProductState', data: [] }, width: 110, align: 'left' },
        { field: 'ProductNote', title: '备注', type: 'string', link: true, sort: true, width: 180, require: true, align: 'left' },
        { field: 'ProductImg', title: '图片', type: 'img', width: 220, align: 'left' }]);
        const detail = ref({
            cnName: "#detailCnName",
            table: "#detailTable",
            columns: [],
            sortName: "",
            key: ""
        });
        return {
            table,
            extend,
            editFormFields,
            editFormOptions,
            searchFormFields,
            searchFormOptions,
            columns,
            detail,
        };
    },
});
</script>
